package vip.xiaonuo.smzq.modular.drkqs.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.drkqs.entity.KclZb;
import vip.xiaonuo.smzq.modular.drkqs.service.IKclZbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 地热矿泉水矿储量坐标
 *
 * @author eomer
 * @since 2024-02-22
 */
@Api(tags = "地热矿泉水矿储量坐标")
@RestController
@RequestMapping("/drkqs/kclZb")
@Validated
public class KclZbController {

    @Resource
    private IKclZbService iKclZbService;

    /**
     * 添加地热矿泉水矿储量坐标
     */
    @ApiOperation("添加地热矿泉水矿储量坐标")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid KclZb kclZb) {
        iKclZbService.save(kclZb);
        return CommonResult.ok();
    }

    /**
     * 删除地热矿泉水矿储量坐标
     */
    @ApiOperation("删除地热矿泉水矿储量坐标")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iKclZbService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑地热矿泉水矿储量坐标
     */
    @ApiOperation("编辑地热矿泉水矿储量坐标")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid KclZb kclZb) {
        iKclZbService.updateById(kclZb);
        return CommonResult.ok();
    }

    /**
     * 地热矿泉水矿储量坐标分页查询
     */
    @ApiOperation("地热矿泉水矿储量坐标分页查询")
    @GetMapping("/list")
    public CommonResult<Page<KclZb>> page() {
        return CommonResult.data(iKclZbService.page(new KclZb()));
    }
}
